<?php

class Book_Form_Admin_Settings_Level extends Authorization_Form_Admin_Level_Abstract {

    public function init() {

        //select level
        $t = parent::init();

        if (!$this->isPublic()) {

            // Element: create
            $this->addElement('Radio', 'create', array(
                'label' => 'Allow Creation of Books?',
                'multiOptions' => array(
                    1 => 'Yes, allow creation of books.',
                    0 => 'No, do not allow books to be created.'
                ),
                'value' => 1,
            ));

            // Element: edit
            $this->addElement('Radio', 'edit', array(
                'label' => 'Allow Editing of Books?',
                'multiOptions' => array(
                    2 => 'Yes, allow members to edit all books.',
                    1 => 'Yes, allow members to edit their own books.',
                    0 => 'No, do not allow members to edit their books.',
                ),
                'value' => ( $this->isModerator() ? 2 : 1 ),
            ));
            if (!$this->isModerator()) {
                unset($this->edit->options[2]);
            }

            // Element: delete
            $this->addElement('Radio', 'delete', array(
                'label' => 'Allow Deletion of Books?',
                'multiOptions' => array(
                    2 => 'Yes, allow members to delete all books.',
                    1 => 'Yes, allow members to delete their own books.',
                    0 => 'No, do not allow members to delete their books.',
                ),
                'value' => ( $this->isModerator() ? 2 : 1 ),
            ));
            if (!$this->isModerator()) {
                unset($this->delete->options[2]);
            }
        }
    }

}
